#ifndef RENDERER_H
#define RENDERER_H
#include "engine_api.h"
#include <d3d9.h>
#include <d3dx9.h>
#include <D3dx9math.h>
#include "Vertexbuffer.h"
#include "RenderTypes.h"
#include "engine_api.h"
#include "MathDX.h"
#include <string.h>
#include <vector>

#pragma comment (lib, "d3d9.lib")
namespace pg1{
class ENGINE_API Renderer{

public:

	Renderer();
	~Renderer();

	bool init(HWND hWnd);
	void Draw(ColorVertex* apkVertices, Primitive ePrimitive,size_t vertexCount);
	void Draw(TextureCoordVertex* apkVertex, Primitive ePrimitive, size_t vertexCount);
	void beginFrame();
	void endFrame();
	void setMatrix(MatrixType eMatrixType,const Matrix&);
	void setCurrentTexture(const Texture& rkTexture);
	const Texture loadTexture(const std::string& rkFilename,int COLOR);
private:
	pg1::VertexBuffer* r_colorVB;
	pg1::VertexBuffer* m_pkTextureCoordVB; 
	std::vector<pg1::Texture> m_akTextures;
	//directx stuff
	D3DXMATRIX* matProjection; 
	IDirect3D9 *r_D3D;
	IDirect3DDevice9 *r_Device;
	pg1::VertexBuffer *m_pkVertexbuffer;
	VertexBuffer *r_vertexbuffer;
	//VertexBuffer *r_colorVB;
	UINT r;
	UINT g;
	UINT b;
};
}
#endif